package org.csu.canteen.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.csu.canteen.entity.Item;
import org.csu.canteen.entity.Log;
import org.csu.canteen.persistence.LogMapper;
import org.csu.canteen.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("logService")
public class LogServiceImpl implements LogService {
    @Autowired
    private LogMapper logMapper;

    //已测试
    @Override
    public int recordLog(Log log) {
        return logMapper.insert(log);
    }

    //已测试
    @Override
    public List<Log> searchHistory(String username) {
        //条件查询
        QueryWrapper<Log> queryWrapper=new QueryWrapper<>();
        //构造条件
        queryWrapper.eq("username",username);
        List<Log> logList=logMapper.selectList(queryWrapper);
        return logList;
    }


}
